package magicboard.classifier.feature.features
{
	import magicboard.geometry.algorithms.DPPolylineSimplification;
	import magicboard.model.InkStroke;
	
	/**
	 * Extract number of segments.
	 */
	public class SegmentCountFeature extends FeatureExtractor{
		
		public static var ID:String = "segmentcount";
		 
		// --------------------------------------------------------------------------------------------
		public function SegmentCountFeature(){
			
			super(ID);
		}
		
		// --------------------------------------------------------------------------------------------
		/**
		 * Uses Douglas-Peucker Algorithm with tolerance equal to 5% of bounding box diagonal
		 */
		override public function extract(stroke:InkStroke):Number{
			
			return stroke.simplifiedPoints.length-1;
		}
		
		// --------------------------------------------------------------------------------------------
		// Private members
	}
}